package org.easy.bochaai.dto;

import com.alibaba.fastjson.annotation.JSONField;
import lombok.Data;

import java.util.List;

@Data
public class WebSearchResponse {


    @JSONField(name = "_type")
    private String type;

    @JSONField(name = "queryContext")
    private QueryContext queryContext;

    @JSONField(name = "webPages")
    private WebPages webPages;

    @JSONField(name = "images")
    private Images images;

    @JSONField(name = "videos")
    private Object videos;

    @Data
    public static class QueryContext {

        @JSONField(name = "originalQuery")
        private String originalQuery;
    }

    @Data
    public static class WebPages {

        @JSONField(name = "webSearchUrl")
        private String webSearchUrl;

        @JSONField(name = "totalEstimatedMatches")
        private int totalEstimatedMatches;

        @JSONField(name = "value")
        private List<WebPagesValue> webPagesValue;

        @JSONField(name = "someResultsRemoved")
        private boolean someResultsRemoved;


    }

    @Data
    public static class WebPagesValue {

        @JSONField(name = "id")
        private Object id;

        private String name;

        private String url;

        @JSONField(name = "displayUrl")
        private String displayUrl;

        private String snippet;

        private String summary;

        @JSONField(name = "dateLastCrawled")
        private String dateLastCrawled;

        @JSONField(name = "cachedPageUrl")
        private Object cachedPageUrl;

        @JSONField(name = "language")
        private String language;

        @JSONField(name = "isFamilyFriendly")
        private Boolean isFamilyFriendly;

        @JSONField(name = "isNavigational")
        private Boolean isNavigational;
    }

    @Data
    public static class Images {

        @JSONField(name = "id")
        private String id;

        @JSONField(name = "readLink")
        private String readLink;

        @JSONField(name = "webSearchUrl")
        private String webSearchUrl;

        @JSONField(name = "value")
        private List<ImagesValue> imagesValue;

        @JSONField(name = "isFamilyFriendly")
        private Boolean isFamilyFriendly;

        @Data
        public static class ImagesValue {

            @JSONField(name = "webSearchUrl")
            private String webSearchUrl;

            @JSONField(name = "name")
            private String name;

            @JSONField(name = "thumbnailUrl")
            private String thumbnailUrl;

            @JSONField(name = "datePublished")
            private String datePublished;

            private String contentUrl;

            @JSONField(name = "hostPageUrl")
            private String hostPageUrl;

            @JSONField(name = "contentSize")
            private String contentSize;

            @JSONField(name = "encodingFormat")
            private String encodingFormat;

            @JSONField(name = "hostPageDisplayUrl")
            private String hostPageDisplayUrl;

            private int width;

            private int height;

            @JSONField(name = "thumbnail")
            private String thumbnail;
        }
    }
}